package com.iplant.mes.serviceImpl.dao.qms;

import com.iplant.base.po.OutResult;
import com.iplant.base.utils.annotation.dao.DBBaseDAO;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.basic.serviceImpl.dao.TaskBaseDao;
import com.iplant.mes.service.po.qms.QMSMaterialCheck;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@DBBaseDAO(QMSMaterialCheck.class)
@Slf4j
public class QMSMaterialCheckDAO extends TaskBaseDao<QMSMaterialCheck> {

    private static QMSMaterialCheckDAO Instance = null;

    public static QMSMaterialCheckDAO getInstance() {
        if (Instance == null) {
            Instance = new QMSMaterialCheckDAO();
        }
        return Instance;
    }

    public QMSMaterialCheckDAO() {
        super(QMSMaterialCheck.class);
        this.Init();
    }


    public QMSMaterialCheck QMS_GetMaterialCheck(BMSEmployee wLoginUser, int wMaterialID, String wBatchRecordCode,
                                                 OutResult<Integer> wErrorCode) {
        Map<String, Object> wParams = new HashMap<>();
        wParams.put("MaterialID", wMaterialID);
        wParams.put("BatchRecordCode", wBatchRecordCode);

        return this.SelectPO(wLoginUser, wParams, wErrorCode);
    }

    public List<QMSMaterialCheck> QMS_GetMaterialCheckList(BMSEmployee wLoginUser, List<String> wBatchRecordCodeList,
                                                           OutResult<Integer> wErrorCode) {
        Map<String, Object> wParams = new HashMap<>();
        wParams.put("BatchRecordCode", wBatchRecordCodeList);
        return this.SelectPO(wLoginUser, wParams, wErrorCode);
    }

    @Override
    protected void Initialize() {
        super.SetInstance(this);
    }
}
